<%--
  Created by IntelliJ IDEA.
  User: oooo
  Date: 2018/5/6
  Time: 21:35
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<form action="loginHandler.jsp" method="post">
    用户名：<input type="text" name="username"/><br/>
    密码：<input type="text" name="password"/><br/>
    <input type="submit" value="登录"/>
</form>
</body>
</html>
longinHandler
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    String username = request.getParameter("username");
    String password = request.getParameter("password");
    //3+1 去查找数据库，有没有这样的账号和密码！！！！
    if (username.equals("admin")&&password.equals("123456")){
        //登录成功
        session.setAttribute("username",username);
        response.sendRedirect("userList.jsp");
    }else {
        out.write("<h1>登录失败！！！</h1>");
        out.write("<a href='login.jsp'>重新登录</a>");
    }
%>
</body>
</html>

